<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>社团列表</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="/css/font-awesome.css">
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/djs.css">


    <script type="text/javascript" src="/js/user.js"></script>
    <script type="text/javascript" src="/js/base.js"></script>


    <script src="/json/CityJson.js" type="text/javascript" charset="utf-8"></script>
    <script src="/json/ProJson.js" type="text/javascript" charset="utf-8"></script>
    <script src="/json/DistrictJson.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="top">

</div>
<div class="container">
    <div id="asideAffix" class="aside" data-spy="affix">
    </div>
    <div class="centers content editcontent" style="margin-top: 0;">
        <form role="form" id="editForm" class="form-horizontal">
        <div class="form-group">
            <div class="col-sm-12">
                <label for="groupCode" class="col-sm-2">一&nbsp;&nbsp;号&nbsp;&nbsp;通：</label>
                <!--<input type="text" id="groupCode" readonly required class="col-sm-4">-->
                <label id="groupCode" class="col-sm-6"></label>
            </div>

            <div class="col-sm-12">
                <label for="name" class="col-sm-2">社团全称：</label>
                <!--<input type="text" id="name" readonly required class="col-sm-4">-->
                <label id="name" class="col-sm-6"></label>
            </div>

            <div class="col-sm-12">
                <label for="shortName" class="col-sm-2">社团简称：</label>
                <!--<input type="text" id="shortName" readonly required class="col-sm-4">-->
                <label id="shortName" class="col-sm-6"></label>
            </div>


            <div class="col-sm-12">
                <label for="monitor" class="col-sm-2">负&nbsp;&nbsp;责&nbsp;&nbsp;人：</label>
                <!--<input type="text" id="monitor" readonly required class="col-sm-4">-->
                <label id="monitor" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="phone" class="col-sm-2">联系电话：</label>
                <!--<input type="text" id="phone" readonly required class="col-sm-4">-->
                <label id="phone" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="district" class="col-sm-2">所在地区：</label>
                <div class="col-sm-6">
                    <label id="province"></label>
                    <label id="city"></label>
                    <label id="district"></label>
                </div>
                <!--<input type="text" id="province" readonly required class="col-sm-4">-->
                <!--<input type="text" id="city" readonly required class="col-sm-4">-->
                <!--<input type="text" id="district" readonly required class="col-sm-4">-->

                <!--<select id="province" class="col-sm-2" disabled="disabled" required></select>-->
                <!--<select id="city" class="col-sm-2" disabled="disabled" required></select>-->
                <!--<select id="district" class="col-sm-2" disabled="disabled" required></select>-->
            </div>
            <div class="col-sm-12">
                <label for="regAddress" class="col-sm-2">详细地址：</label>
                <!--<input type="text" id="regAddress" readonly required class="col-sm-4">-->
                <label id="regAddress" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="setupDate" class="col-sm-2">成立日期：</label>
                <!--<input type="text" id="setupDate" readonly required class="col-sm-4">-->
                <label id="setupDate" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="serviceField" class="col-sm-2">服务领域：</label>
                <!--<input type="text" id="serviceField" readonly required class="col-sm-4">-->
                <label id="serviceField" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="code" class="col-sm-2">社团代码：</label>
                <!--<input type="text" id="code" readonly required class="col-sm-4">-->
                <label id="code" class="col-sm-6"></label>
            </div>
            <div class="col-sm-12">
                <label for="codeImg" class="col-sm-2">社团证件：</label>
                <!--<input type="text" id="codeImg" readonly required class="col-sm-4">-->
                <!--<label id="codeImg" class="col-sm-6"></label>-->
                <img id="codeImg" class="col-sm-6" src="">
            </div>
            <div class="col-sm-12">
                <label for="demo" class="col-sm-2">社团简介：</label>
                <!--<input type="text" id="demo" readonly required class="col-sm-4">-->
                <label id="demo" class="col-sm-6"></label>
            </div>

        </div>
        <div>
            <button type="button" class="col-sm-2 btn btn-primary" id="rollback" style="border-color: #ffd632;background: #ffd632 linear-gradient(to bottom,#ffd632 0,#ffd632 100%);">
                返回
            </button>
        </div>
        </form>
    </div>
</div>
</body>

<script type="text/javascript">
    $(
        function(){
            if (location.search.substr(1).split("=")[1] != undefined && location.search.substr(1).split("=")[1] != 0) {
                setData(location.search.substr(1).split("=")[1]);
            }
        }
    );

    function setProvince(selValue){
        $.each(province, function (k, p) {
            if (p.ProID == selValue) {
                var option = "<option value='" + p.ProID + "'>" + p.ProName + "</option>";
                $("#selDistrict").append(option);
            }
        });
    }

    function setCity(selValue){
        $.each(province, function (k, p) {
            if (p.ProID == selValue) {
                var option = "<option value='" + p.CityID + "'>" + p.CityName + "</option>";
                $("#selDistrict").append(option);
            }
        });
    }

    function setDistrict(selValue){
        $.each(province, function (k, p) {
            if (p.ProID == selValue) {
                var option = "<option value='" + p.Id + "'>" + p.DisName + "</option>";
                $("#selDistrict").append(option);
            }
        });
    }

    function setData(groupId) {
        $.ajax({
            url: '/group/info',// 跳转到 action
            headers: {'Content-type': 'application/json;charset=UTF-8'},//传入数据数据格式 json
            data: JSON.stringify({
                id:groupId
            }),
            type: 'post',
            cache: false,
            dataType: 'json',
            success: function (data) {
                if (data.statusCode == 0) {
                    $("#groupCode").text(data.data.groupCode);
                    $("#name").text(data.data.name);
                    $("#shortName").text(data.data.shortName);
                    $("#monitor").text(data.data.monitor);
                    $("#phone").text(data.data.phone);
//                    setProvince(data.data.prvoince);
                    $("#province").text(data.data.prvoince);
//                    setCity(data.data.city);
                    $("#city").text(data.data.city);
//                    setDistrict(data.data.district);
                    $("#district").text(data.data.district);
                    $("#regAddress").text(data.data.regAddress);
                    $("#setupDate").text(data.data.setupDate);
                    $("#serviceField").text(data.data.serviceField);
                    $("#code").text(data.data.code);
                    $("#codeImg").attr('src',data.data.codeImg);
                    $("#demo").text(data.data.demo);

                } else {
                    alert(data.statusMessage);
                }
            },
            error: function () {
                // view("异常！");
                alert("用户未登录或者服务器连接异常！");
                location.href = "/html/login/login.html";
            }
        });
    }

    $("#rollback").click(function () {
        back()
    });

    function back() {
        location.href = "/html/group/groupList.html";
    }
</script>
</html>